/**
 * Created by yuliang on 2015/8/4.
 */

if (typeof String.prototype.startsWith != 'function') {
    String.prototype.startsWith = function (prefix) {
        return this.slice(0, prefix.length) === prefix;
    };
}


if (typeof String.prototype.endsWith != 'function') {
    String.prototype.endsWith = function (suffix) {
        return this.indexOf(suffix, this.length - suffix.length) !== -1;
    };
}

// Array.prototype.remove = function (dx) {
//     if (isNaN(dx) || dx > this.length) {
//         return false;
//     }
//     for (var i = 0, n = 0; i < this.length; i++) {
//         if (this[i] != this[dx]) {
//             this[n++] = this[i]
//         }
//     }
//     this.length -= 1
// }

Array.prototype.remove = function (v) {
    if (this.indexOf(v) != -1) {
        this.splice(this.indexOf(v), 1);
        return true;
    }
    return false;
}

